$(function(){
		 $(".suggest_ul").hide(0);
});
$(function(){
	$(".suggest_input").keyup(function(){
			if($(".suggest_input").val().length<=0){
				$(".liid").val("");
				$(".suggest_ul").hide(0);
				return; 
			}
		var listTxt = '',li = '', bEqual=false;
		
		  $.ajax({
			    "url" : "http://www.12301.cc/call/jh_prod.php",
				"data" : {action:'admin_land_search', ltitle:$(".suggest_input").val()},
				"dataType":"json",
				"type": 'POST', 
				"success":function(data){
					$(".suggest_ul").show(0);
					//var landid=$(this).val();
					var contents="";
					var liid="";
					var list = data.list;
						for(var i in list){
						var keywords =list[i]["title"];
						var id = list[i]["id"];
						contents=contents+"<li data-id='"+id+"'>"+keywords+"</li>";
						liid=id;
						}
						$(".suggest_ul").html(contents); 
						$(".liid").val(liid);
							$.ajax({
							uri:window.location.href,
							data:"landid="+liid,
							beforeSend:function (XMLHttpRequest) {
								XMLHttpRequest.setRequestHeader("request_type","getTicket");
							},
							success: function(data){
								data = JSON.parse(data);
								if(data.s=='success'){
									_options = '<option value="">--选择--</option>';
									for(var i in data.content){
										_options+='<option value="'+data.content[i].id+'_'+data.content[i].title+'">'+data.content[i].title+'</option>';
									}
									$("#ticket").html(_options);

								}
							}
						});
					}          
			});
			});  
			$(function(){
				/* $(".suggest_input").keyup(function(){
					setInterval(changehover,50);
					function changehover(){
						$(".suggest_ul li").hover(function(){ $(this).css("background",".eee");},function(){ $(this).css("background",".fff");});
						$(".suggest_ul li").click(function(){ $(".suggest_input").val($(this).html());$(".suggest_ul").hide(0);});
					}
				}); */
			});
			$(".suggest_ul").on("click","li",function(e){
				var target = $(e.currentTarget);
				var id = target.data("id");
				$(".suggest_input").val(target.text());
				$(".liid").val(id);
				$(".suggest_ul").hide(0);
			})
	
});
$(function(){
		 $(".suggest_ul_fid").hide(0);
});
$(function(){
	$(".suggest_input_fid").keyup(function(){
			if($(".suggest_input_fid").val().length<=0){
				$(".liid_fid").val("");
				$(".suggest_ul_fid").hide(0);
				return; 
			}
		var listTxt = '',li = '', bEqual=false;
		
		    $.ajax({
			    "url" : "http://www.12301.cc/call/jh_mem.php",
				"data" : {action:'fuzzyGetDname_c', dname:$(".suggest_input_fid").val(),dtype:$(".lid_id_fid").val()},
				"dataType":"json",
				"type": 'POST', 
				"success":function(data){
					$(".suggest_ul_fid").show(0);
					var contents="";
					var li_id="";
					for(var i in data) {
						var keywords = data[i].dname;
						var id = data[i].id;
						contents=contents+"<li data-id='"+id+"'>"+keywords+"</li>";
						li_id=id;
						}
						$(".suggest_ul_fid").html(contents); 
						$(".li_id_fid").val(li_id);
					}          
			});
			});  
			$(".suggest_ul_fid").on("click","li",function(e){
				var target = $(e.currentTarget);
				var id = target.data("id");
				$(".suggest_input_fid").val(target.text());
				$(".liid_fid").val(id);
				$(".suggest_ul_fid").hide(0);
			})
	
});
$(function(){
		 $(".suggest_ul_aid").hide(0);
});
$(function(){
	$(".suggest_input_aid").keyup(function(){
			if($(".suggest_input_aid").val().length<=0){
				$(".liid_aid").val("");
				$(".suggest_ul_aid").hide(0);
				return; 
			}
		var listTxt = '',li = '', bEqual=false;
		
		   $.ajax({
			    "url" : "http://www.12301.cc/call/jh_mem.php",
				"data" : {action:'fuzzyGetDname_c', dname:$(".suggest_input_aid").val(),dtype:$(".lid_id_aid").val()},
				"dataType":"json",
				"type": 'POST', 
				"success":function(data){
					$(".suggest_ul_aid").show(0);
					var contents="";
					var li_id="";
					for(var i in data) {
						var keywords = data[i].dname;
						var id = data[i].id;
						contents=contents+"<li data-id='"+id+"'>"+keywords+"</li>";
						li_id=id;
						}
						$(".suggest_ul_aid").html(contents); 
						$(".li_id_aid").val(li_id);
					}          
			});
			});  
			$(".suggest_ul_aid").on("click","li",function(e){
				var target = $(e.currentTarget); 
				var id = target.data("id");
				$(".suggest_input_aid").val(target.text());
				$(".liid_aid").val(id);
				$(".suggest_ul_aid").hide(0);
			})
	
});


